home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
daymisckit_proj
/
Headers
/
daymisckit
/
DAYString.h
< prev
next >
Wrap
Text File
|
1995-06-12
|
6KB
|
167 lines
//
// DAYString.h -- a generic class to simplify manipulation of (char *)'s
// Written by Don Yacktman (c) 1993 by Don Yacktman.
// Version 1.1. All rights reserved.
//
// This is a free object! Contact the author for the latest version.
// Don Yacktman, 4279 N. Ivy Lane, Provo, UT, 84604
// e-mail: Don_Yacktman@byu.edu
//
// See DAYString.m for details of the software license.
//
#import <appkit/appkit.h>
// special constants for -extractPart... methods
#define DAY_LAST -1
#define DAY_FIRST 1
@interface DAYString:Object <NXTransport>
{
char *buffer;
NXStringOrderTable *orderTable;
int length, _length; // length is string length, _length is buffer size
}
// basic allocation, deallocation methods
+ newWithString:(const char *)aString; // added by Carl
- init;
- initString:(const char *)aString;
- allocateBuffer:(int)size;
- allocateBuffer:(int)size fromZone:(NXZone *)zone;
- read:(NXTypedStream *)stream;
- write:(NXTypedStream *)stream;
- freeString;
- free;
// strcpy(), strlen() covers
- copyFromZone:(NXZone *)zone; // a -copy message calls this.
- setStringValue:(const char *)aString;
- setStringValue:(const char *)aString fromZone:(NXZone *)zone;
- takeStringValue:sender;
- takeStringValue:sender fromZone:(NXZone *)zone;
- (const char *)stringValue;
- (int)length;
// strcat(), strncat() covers
- concatenate:sender;
- concatenate:sender n:(int)n;
- concatenate:sender fromZone:(NXZone *)zone;
- concatenate:sender n:(int)n fromZone:(NXZone *)zone;
- cat:(const char *)aString;
- cat:(const char *)aString n:(int)n;
- cat:(const char *)aString fromZone:(NXZone *)zone;
- cat:(const char *)aString n:(int)n fromZone:(NXZone *)zone;
// strcmp(), strncmp(), strcasecmp(), strncasecmp() covers
- setStringOrderTable:(NXStringOrderTable *)table;
- (NXStringOrderTable *)stringOrderTable;
- (BOOL)isEqual:anObject;
- (int)compareTo:sender;
- (int)compareTo:sender n:(int)n;
- (int)compareTo:sender caseSensitive:(BOOL)sense;
- (int)compareTo:sender n:(int)n caseSensitive:(BOOL)sense;
- (int)cmp:(const char *)aString;
- (int)cmp:(const char *)aString n:(int)n;
- (int)casecmp:(const char *)aString;
- (int)casecmp:(const char *)aString n:(int)n;
- (const char *)strstr:(const char *)subString;
// Carls' new comparisons
- (int)endcmp:(const char *)aString;
- (int)endcmp:(const char *)aString n:(int)n;
- (int)endcasecmp:(const char *)aString;
- (int)endcasecmp:(const char *)aString n:(int)n;
- (int)endCompareTo:(id)sender;
- (int)endCompareTo:(id)sender caseSensitive:(BOOL)sense;
- (int)endCompareTo:(id)sender n:(int)n;
- (int)endCompareTo:(id)sender n:(int)n caseSensitive:(BOOL)sense;
// like BASIC's left$(), right$(), and mid$(); all return a new instance.
- left:(int)count;
- right:(int)count;
- midFrom:(int)start to:(int)end;
- midFrom:(int)start length:(int)len;
- left:(int)count fromZone:(NXZone *)zone;
- right:(int)count fromZone:(NXZone *)zone;
- midFrom:(int)start to:(int)end fromZone:(NXZone *)zone;
- midFrom:(int)start length:(int)len fromZone:(NXZone *)zone;
- subStringRight:subString;
- subStringLeft:subString;
// misc stuff that can be useful
- encrypt:salt; // UNIX passwords, etc. uses crypt(3), nothing fancy.
- extractPart:(int)n useAsDelimiter:(char)c caseSensitive:(BOOL)sense fromZone:(NXZone *)zone;
- extractPart:(int)n useAsDelimiter:(char)c caseSensitive:(BOOL)sense;
- extractPart:(int)n useAsDelimiter:(char)c fromZone:(NXZone *)zone;
- extractPart:(int)n useAsDelimiter:(char)c;
- fileNameFromZone:(NXZone *)zone;
- fileName;
- pathNameFromZone:(NXZone *)zone;
- pathName;
// private methods: do not use these!
- _unhookBuffer;
// Interface Builder support
- (const char *)getInspectorClassName;
- (NXImage *)getIBImage;
// The rest of Carl's methods...
// Insertion
- insert:(const char *)aString at:(int)index;
- insertChar:(char)aChar at:(int)index;
- insertString:(id)sender at:(int)index;
- addChar:(char)aChar;
// Deletion
- trimLeadSpaces;
- trimTailSpaces;
- trimSpaces;
- squashSpaces;
- removeFrom:(int)start length:(int)len;
- removeFrom:(int)start to:(int)end;
// Replacement
- replaceCharAt:(int)index with:(char)aChar;
- replaceFrom:(int)start length:(int)len withChar:(char)aChar;
- replaceFrom:(int)start to:(int)end withChar:(char)aChar;
- replaceFrom:(int)start length:(int)len with:(const char *)aString;
- replaceFrom:(int)start to:(int)end with:(const char *)aString;
- replaceFrom:(int)start length:(int)len withString:(id)sender;
- replaceFrom:(int)start to:(int)end withString:(id)sender;
- replace:(const char *)subString with:(const char *)newString;
- replace:(const char *)subString withString:(id)sender;
// Finding occurences of characters
- (int)rspotOf:(char)aChar;
- (int)rspotOf:(char)aChar caseSensitive:(BOOL)sense;
- (int)rspotOf:(char)aChar occurenceNum:(int)n;
- (int)rspotOf:(char)aChar occurenceNum:(int)n caseSensitive:(BOOL)sense;
- (int)spotOf:(char)aChar;
- (int)spotOf:(char)aChar caseSensitive:(BOOL)sense;
- (int)spotOf:(char)aChar occurenceNum:(int)n;
- (int)spotOf:(char)aChar occurenceNum:(int)n caseSensitive:(BOOL)sense;
// index(), rindex() covers (actually, clones: rindex() & index() aren't used)
- (const char *)rindex:(char)aChar;
- (const char *)rindex:(char)aChar caseSensitive:(BOOL)sense;
- (const char *)rindex:(char)aChar occurenceNum:(int)n;
- (const char *)rindex:(char)aChar occurenceNum:(int)n caseSensitive:(BOOL)sense;
- (const char *)index:(char)aChar;
- (const char *)index:(char)aChar caseSensitive:(BOOL)sense;
- (const char *)index:(char)aChar occurenceNum:(int)n;
- (const char *)index:(char)aChar occurenceNum:(int)n caseSensitive:(BOOL)sense;
// Miscellaneous:
- wordNum :(int) num;
- (int)numWords;
- reverse;
- toUpper;
- toLower;
- (char)charAt:(int)index;
@end